/**
 * Created by dell on 2016/11/24.
 */
            var $table;
            $(function () {
                initTable();
            });
            function tableHeight() {
                return $(window).height() - 195;
            }
            //初始化表格
            function initTable() {
                $table = $('#fullTab').bootstrapTable({
                    //method: 'get',
                    //toolbar: '#toolbar',
                    cache: false,
                    striped: true,
                    pagination: true,
                    sortable: true,
                    height:tableHeight(),
                    queryParams: function (param) {
                        return param;
                    },
                    pageSize: 10,
                    pageList: [10, 25, 50, 100],
                    minimumCountColumns: 2,
                    clickToSelect: true,
                    columns: [
                        {
                            title:'申请信息',
                            field:'info',
                            //events:operateEvents,
                            //formatter:function(value,row,index){
                            //    var abc=row.info
                            //    var arr=abc.split('<br/>');
                            //    //for(var i=0;arr.length;i++){
                            //    //
                            //    //}
                            //    arr.slice(4)
                            //    console.log(arr);
                            //}
                        },
                        {
                            title:'产品',
                            field:'product',
                        },
                        {
                            title:'评茶师',
                            field:'teaMaster',
                        },
                        {
                            title:'取样',
                            field:'getSample',
                        },
                        {
                            title:'包装',
                            field:'wrap',
                        },
                        {
                            title:'寄样',
                            field:'sendSample',
                        },
                        {
                            title:'结果处理',
                            field:'result',
                        },
                        {
                            title:'操作',
                            field:'operate',
                        },
                        ],
                    data:[{
                        "info":"申请时间：2016-07-10 20:36<br/>"
                        +"申请编号:23499123<br/>"
                        +"申请人：张小泉<br/>",
                        "product":"产品名称：小泉朴茶<br/>"
                        +"种类：红茶<br/>"
                        +"产品编号：KA231<br/>"
                        +"产品批次：FHIO123<br/>"
                        +"等级：一级<br/>",
                        teaMaster:'<span>办理(8/9)</span>',
                        getSample:'<span class="getSample">办理</span>',
                        wrap:'<span>办理</span>',
                        sendSample:'<span>办理(0/9)</span>',
                        result:'<span>办理</span>',
                        operate:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info":"申请时间：2016-10-10 13:13<br/>"
                        +"申请编号:456231<br/>"
                        +"申请人：李琪<br/>",
                        "product":"产品名称：琪茶<br/>"
                        +"种类：黑茶<br/>"
                        +"产品编号：KKL00<br/>"
                        +"产品批次：PKDJ9988<br/>"
                        +"等级：一级<br/>",
                        teaMaster:'<span>办理(8/9)</span>',
                        getSample:'<span class="getSample">办理</span>',
                        wrap:'<span>办理</span>',
                        sendSample:'<span>办理(0/9)</span>',
                        result:'<span>办理</span>',
                        operate:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info":"申请时间：2016-07-22 10:41<br/>"
                        +"申请编号:123562<br/>"
                        +"申请人：陈珊<br/>",
                        "product":"产品名称：栅茶<br/>"
                        +"种类：白茶<br/>"
                        +"产品编号：KVL03<br/>"
                        +"产品批次：FHBF2388<br/>"
                        +"等级：一级<br/>",
                        teaMaster:'<span>办理(8/9)</span>',
                        getSample:'<span class="getSample">办理</span>',
                        wrap:'<span>办理</span>',
                        sendSample:'<span>办理(0/9)</span>',
                        result:'<span>办理</span>',
                        operate:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info":"申请时间：2016-08-01 14:10<br/>"
                        +"申请编号:194145<br/>"
                        +"申请人：周松<br/>",
                        "product":"产品名称：松茶<br/>"
                        +"种类：绿茶<br/>"
                        +"产品编号：KKL00<br/>"
                        +"产品批次：PKDJ9988<br/>"
                        +"等级：一级<br/>",
                        teaMaster:'<span>办理(8/9)</span>',
                        getSample:'<span class="getSample">办理</span>',
                        wrap:'<span>办理</span>',
                        sendSample:'<span>办理(0/9)</span>',
                        result:'<span>办理</span>',
                        operate:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info":"申请时间：2016-08-01 14:10<br/>"
                        +"申请编号:194145<br/>"
                        +"申请人：周松<br/>",
                        "product":"产品名称：松茶<br/>"
                        +"种类：绿茶<br/>"
                        +"产品编号：KKL00<br/>"
                        +"产品批次：PKDJ9988<br/>"
                        +"等级：一级<br/>",
                        teaMaster:'<span>办理(8/9)</span>',
                        getSample:'<span class="getSample">办理</span>',
                        wrap:'<span>办理</span>',
                        sendSample:'<span>办理(0/9)</span>',
                        result:'<span>办理</span>',
                        operate:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    }],
                });
                $table1 = $('#fullTab2').bootstrapTable({
                    //method: 'get',
                    //toolbar: '#toolbar',
                    striped: true,
                    pagination: true,
                    sortable: true,
                    pageSize: 10,
                    pageList: [10, 25, 50, 100],
                    search: true,
                    showColumns: true,
                    showRefresh: true,
                    data:[{
                        "info1":"申请时间：2016-08-01 14:10<br/>"
                        +"申请编号:194145<br/>"
                        +"申请人：周松<br/>",
                        "product1":"产品名称：松茶<br/>"
                        +"种类：绿茶<br/>"
                        +"产品编号：KKL00<br/>"
                        +"产品批次：PKDJ9988<br/>"
                        +"等级：一级<br/>",
                        teaMaster1:'<span>办理(3/9)</span>',
                        getSample1:'<span class="getSample">办理</span>',
                        wrap1:'<span>办理</span>',
                        sendSample1:'<span>办理(1/9)</span>',
                        result1:'<span>办理</span>',
                        operate1:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info1":"申请时间：2016-07-10 20:36<br/>"
                        +"申请编号:23499123<br/>"
                        +"申请人：张小泉<br/>",
                        "product1":"产品名称：小泉朴茶<br/>"
                        +"种类：红茶<br/>"
                        +"产品编号：KA231<br/>"
                        +"产品批次：FHIO123<br/>"
                        +"等级：一级<br/>",
                        teaMaster1:'<span>办理(4/9)</span>',
                        getSample1:'<span class="getSample">办理</span>',
                        wrap1:'<span>办理</span>',
                        sendSample1:'<span>办理(6/9)</span>',
                        result1:'<span>办理</span>',
                        operate1:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info1":"申请时间：2016-10-10 13:13<br/>"
                        +"申请编号:456231<br/>"
                        +"申请人：李琪<br/>",
                        "product1":"产品名称：琪茶<br/>"
                        +"种类：黑茶<br/>"
                        +"产品编号：KKL00<br/>"
                        +"产品批次：PKDJ9988<br/>"
                        +"等级：一级<br/>",
                        teaMaster1:'<span>办理(1/9)</span>',
                        getSample1:'<span class="getSample">办理</span>',
                        wrap1:'<span>办理</span>',
                        sendSample1:'<span>办理(4/9)</span>',
                        result1:'<span>办理</span>',
                        operate1:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    },{
                        "info1":"申请时间：2016-07-22 10:41<br/>"
                        +"申请编号:123562<br/>"
                        +"申请人：陈珊<br/>",
                        "product1":"产品名称：栅茶<br/>"
                        +"种类：白茶<br/>"
                        +"产品编号：KVL03<br/>"
                        +"产品批次：FHBF2388<br/>"
                        +"等级：一级<br/>",
                        teaMaster1:'<span>办理(8/9)</span>',
                        getSample1:'<span class="getSample">办理</span>',
                        wrap1:'<span>办理</span>',
                        sendSample1:'<span>办理(0/9)</span>',
                        result1:'<span>办理</span>',
                        operate1:'<a href="#" class="tblue">终止<br/>办理详情</a>',
                    }],
                });
            }

            //日期选择
            var start={
                elem:'#start0',
                event:'focus',
                isclear: false, //是否显示清空
                istoday: false, //是否显示今天
                issure: true,
                choose:function(datas){
                    end.min = datas;//开始日选好后，重置结束日的最小日期
                    end.start = datas;//将结束日的初始值设定为开始日
                }
            }
            var end={
                elem:'#end0',
                event:'focus',
                choose:function(datas){
                    start.max = datas;//结束日选好后,重置开始日的最大日期.
                }
            }
            $('.calendar').on('click',function(){
                $(this).next().trigger('focus')
            })
            laydate(start)
            laydate(end)
            //切换表格
            var pilis=$('.nav-pills li');
            pilis.on('click',function(e){
                $(this).attr('class','active').siblings().attr('class','')
            });
            $('#method').on('click',function(){
                $('.portlet-body1').show();
                $('.portlet-body').hide();
            });
            $('#norm').on('click',function(){
                $('.portlet-body1').hide();
                $('.portlet-body').show();
            });
            //取样
            $(function(){
                $('.getSample').on('click',function(){
                    parent.layer.open({
                        type: 2,
                        skin: 'layui-layer-lan',
                        title: '取样',
                        fix: true,
                        shade: 0.3,
                        area:['600px','600px'],
                        shadeClose: true, //开启遮罩关闭
                        //content:'newModule/evaluate/getSample.html',
                        content:'newModule/demo.html',
                        //btn:['完成'],btn1:function(index,layero){//保存按钮的回调
                        //    var body=layer.getChildFrame($('body'), index);
                        //    var iframeWin = layero.find('iframe')[0].contentWindow;
                        //    iframeWin.he();
                        //    location.reload();
                        //    parent.parent.layer.msg('保存成功', {time:3000,icon: 1})
                        //    setInterval(function(){
                        //        parent.layer.closeAll();
                        //    },5000)
                        //},
                    });
                });
            })
            $(function(){
                var sam=$('.getSample');
                for(var i=0;i<sam.length;i++){
                    $(sam[i]).on('click',function(){
                        var str=$(this).parent().parent().find('td:first-child').html();
                        var arr=str.split('<br>');
                        var thatId=arr[1];
                        var thatNum=thatId.split(':');
                        function thisID(){
                            return thatNum[1];
                        };
                    })
                }
            })
            //function getSample(value,row,index){
            //    $(row.getSample).click(function(){
            //        alert(1)
            //    })
            //}